import request from '@/utils/request'
import { ObjectType, ResponseDataPromise } from 'typings/interfaces'
import * as proxy from '@/constants/proxy'
import download from '@/utils/download'
// import { Pagination } from '@/components/Records/types'
// import axios from 'axios'
// import { getToken } from '@/utils/auth'
export interface IndexListParams extends ObjectType {
    param?: string
    type: string  //1中交2中咨
}

// export const superIndexSdBanklistRequests = (
//   pagination: Omit<Pagination, 'total'>,
//   data: Params
// ): ResponseDataPromise<ObjectType> =>
//   request({
//     url: proxy.CHECC_API_CMS + '/rm-repair-acceptance/road',
//     method: 'post',
//     data,
//     params: pagination,
//   })

export const zzPlanlistRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce/pageList',
        method: 'post',
        data,
    })
export const deleteZzPlanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce/delete',
        method: 'post',
        data,
    })
export const updateZzPlanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce/update',
        method: 'post',
        data,
    })
export const childrenPlanlistRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/pageList',
        method: 'post',
        data,
    })
export const updateFactorRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/updateFactor',
        method: 'post',
        data,
    })
export const revertDistributeRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/revert',
        method: 'post',
        data,
    })
export const produceExamineRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/produceExamine',
        method: 'post',
        data,
    })
export const downDistributeRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/downDistribute',
        method: 'post',
        data,
    })
export const planIndexDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/planDetail',
        method: 'post',
        data,
    })
export const planDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/detail',
        method: 'post',
        data,
    })
export const openPlanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/open',
        method: 'post',
        data,
    })
export const closePlanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/close',
        method: 'post',
        data,
    })
export const updatePlanDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/update',
        method: 'post',
        data,
    })
export const simulateDegradeRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/simulateDegrade',
        method: 'post',
        data,
    })
export const simulateDegradeSaveRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/simulateDegradeSave',
        method: 'post',
        data,
    })
export const updateScoreRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/updateScore',
        method: 'post',
        data,
    })
export const stopExamineRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/stopExamine',
        method: 'post',
        data,
    })
export const pageLocalListRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/pageLocalList',
        method: 'post',
        data,
    })
export const examineDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/examineDetail',
        method: 'post',
        data,
    })
export const ensureAndRejectRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/ensureAndReject',
        method: 'post',
        data,
    })
export const scoreDetaillistRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-score-detail/list',
        method: 'post',
        data,
    })
export const updateExScoreRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-score-detail/update',
        method: 'post',
        data,
    })
export const evaluateSaveRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/evaluateSave',
        method: 'post',
        data,
    })
export const evaluateDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item-index/evaluateDetail',
        method: 'post',
        data,
    })

export function downloadFileRequest(fileId: string): Promise<any> {
    return download({
        url: proxy.CHECC_API_FAST_DFS + '/file/download',
        params: {
            fileId,
        },
    })
}

export function downloadByUrl(fileId: any) {
    return download({
        url: '/fastDfs/file/download',
        params: {
            fileId,
        },
    })
}
export const indexDecomposeRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-simulate-degrade/overview1',
        method: 'post',
        data,
    })
export const updateScoreZjdRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-simulate-degrade/updateScore',
        method: 'post',
        data,
    })

export const saveScoreZjdRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/super-index-simulate-degrade-edit-record/saveBatch',
        method: 'post',
        data,
    })
export const exportZjdRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-simulate-degrade/export',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const degradeDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-simulate-degrade/degradeDetail',
        method: 'post',
        data,
    })
export const exportZzExplanRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce/export',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportZzplanlsitRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/pageListExport',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportPlanDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/planDetailExport',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportEveryExRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce/export',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportExDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/examineDetailExport',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportSelfExRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/pageLocalListExport',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const exportScoreDetailRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-index-score-detail/export',
        method: 'post',
        data,
        responseType: 'blob'
    })
export const warnRemindRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
    request({
        url: proxy.CHECC_API_CMS + '/khgl/my-annual-examine-plan-produce-item/warnRemind',
        method: 'post',
        data,
    })


